<?php
//shop 通用接口
Route::group(
    [
        'middleware' => 'api',
        'prefix' => 'api/shop',
        'namespace' => 'Summer\Shop\Http\Controllers',
    ],
    function () {
        //不需要登录到接口,原则是和用户无关到信息都不加auth
        //【优惠劵】优惠劵
        Route::post(
            'coupon/index',
            'CouponController@index'
        )->name('api.shop.coupon.index');
        //【评价】商品评价
        Route::post(
            'comment/index',
            'CommentController@index'
        )->name('api.shop.comment.index');
        //【商品】商品列表
        Route::post(
            'product/index',
            'ProductController@index'
        )->name('api.shop.product.index');
        //【商品】商品详情
        Route::post(
            'product/preview',
            'ProductController@preview'
        )->name('api.shop.product.preview');
        //【分类】类型
        Route::post(
            'category/type',
            'CategoryController@type'
        )->name('api.shop.category.type');
        //【分类】分类列表
        Route::post(
            'category/index',
            'CategoryController@index'
        )->name('api.shop.category.index');
        //【模版】
        Route::post(
            'index/template',
            'IndexController@template'
        )->name('api.shop.index.template');
        //【路由表】
        Route::post(
            'index/asyncPages',
            'IndexController@asyncPages'
        )->name('api.shop.index.asyncPages');

        //【初始化】配置初始化
        Route::POST(
            'index/init',
            'IndexController@init'
        )->name('api.shop.index.init');

        //【积分商城】商品列表
        Route::post(
            'score_goods/index',
            'ScoreGoodsController@index'
        )->name('api.shop.score_goods.index');
        //【积分商城】商品详情
        Route::post(
            'score_goods/preview',
            'ScoreGoodsController@preview'
        )->name('api.shop.score_goods.preview');

        //需要登录次能显示
        Route::middleware(['Summer\Hub\Http\Middleware\HubJwtAuthMiddleware'])->group(
            function () {

                //【分销商品】商品列表
                Route::post(
                    'reg_goods/index',
                    'RegGoodsController@index'
                )->name('api.shop.reg_goods.index');

                //【用户】商城相关用户信息
                Route::post(
                    'user/userData',
                    'UserController@userData'
                )->name('api.shop.user.userData');

                //【足迹】浏览记录
                Route::post(
                    'browse/index',
                    'BrowseController@index'
                )->name('api.shop.browse.index');
                //【足迹】删除浏览记录
                Route::post(
                    'browse/delete',
                    'BrowseController@delete'
                )->name('api.shop.browse.delete');

                //【收藏】商品收藏列表
                Route::post(
                    'favorite/index',
                    'FavoriteController@index'
                )->name('api.shop.favorite.index');
                //【收藏】收藏商品
                Route::post(
                    'favorite/create',
                    'FavoriteController@create'
                )->name('api.shop.favorite.create');
                //【收藏】取消收藏商品
                Route::post(
                    'favorite/delete',
                    'FavoriteController@delete'
                )->name('api.shop.favorite.delete');

                //【评价】评价订单
                Route::post(
                    'comment/create',
                    'CommentController@create'
                )->name('api.shop.comment.create');
                //【订单】预支付订单
                Route::post(
                    'order/checkCreate',
                    'OrderController@checkCreate'
                )->name('api.shop.order.checkCreate');
                //【订单】结算订单-立即购买和购物车统一下单
                Route::post(
                    'order/submit',
                    'OrderController@submit'
                )->name('api.shop.order.submit');
                //【订单】订单列表
                Route::post(
                    'order/index',
                    'OrderController@index'
                )->name('api.shop.order.index');
                //【订单】支付详情
                Route::post(
                    'order/preview',
                    'OrderController@preview'
                )->name('api.shop.order.preview');
                //【订单】物流信息
                Route::post(
                    'order/express',
                    'OrderController@express'
                )->name('api.shop.order.express');
                //【订单】订单商品详情
                Route::post(
                    'order/itemDetail',
                    'OrderController@itemDetail'
                )->name('api.shop.order.itemDetail');
                //【订单】支付订单
                Route::post(
                    'order/pay',
                    'OrderController@pay'
                )->name('api.shop.order.pay');
                //【订单】取消订单
                Route::post(
                    'order/cancel',
                    'OrderController@cancel'
                )->name('api.shop.order.cancel');
                //【订单】删除订单
                Route::post(
                    'order/delete',
                    'OrderController@delete'
                )->name('api.shop.order.delete');
                //【订单】确认收货
                Route::post(
                    'order/confirm',
                    'OrderController@confirm'
                )->name('api.shop.order.confirm');


                //【订单】订单评价
                Route::post(
                    'order/review',
                    'OrderController@review'
                )->name('api.shop.order.review');

                //【购物车】添加购物车
                Route::post(
                    'cart/addToCart',
                    'CartController@addToCart'
                )->name('api.shop.cart.addToCart');
                //【购物车】购物车列表
                Route::post(
                    'cart/index',
                    'CartController@index'
                )->name('api.shop.cart.index');
                //【购物车】更新购物车
                Route::post(
                    'cart/update',
                    'CartController@update'
                )->name('api.shop.cart.update');
                //【购物车】删除购物车
                Route::post(
                    'cart/delete',
                    'CartController@delete'
                )->name('api.shop.cart.delete');


            }
        );

    }
);



